package com.banyuan.lesson.工具类.日历类0521;

import java.util.Calendar;

public class Define {
    public static void main(String[] args) {
        //打印1949-10-01 是星期几
        Calendar calendar = Calendar.getInstance();
        System.out.println(calendar);

        //月份从0开始
        calendar.set(1949,Calendar.OCTOBER,1);
        int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
        System.out.println(dayOfWeek);

        //每个月的最后一天
        int i = calendar.getActualMaximum(Calendar.DATE);
        System.out.println(i);

        //默认的模式是宽松模式，没有该天就往后退
        calendar.set(2021, 1, 31);
        System.out.println(calendar.get(Calendar.DAY_OF_WEEK));

       // 设置成严格模式
//        calendar.setLenient(false);//关闭宽松模式；
//        calendar.set(2021, 1, 31);
//        System.out.println(calendar.get(Calendar.DAY_OF_WEEK));
    }
}
